import json

def check_segmentations(file_path):
    # 加载 JSON 文件
    with open(file_path, 'r') as f:
        data = json.load(f)

    # 检查每个标注中的分割数据
    for annotation in data['annotations']:
        segmentation = annotation['segmentation']
        
        if isinstance(segmentation, dict):
            print(f"Annotation {annotation['id']} uses RLE.")
        elif isinstance(segmentation, list):
            # 检查每个多边形分割是否小于等于 4 个点
            for poly in segmentation:
                if len(poly) <= 4:
                    print(f"Annotation {annotation['id']} has a segmentation with 4 or fewer points: {poly}")

file_path = 'test.json'
check_segmentations(file_path)
